package com.circle.rest.core.common.enums;

/**
 * @program: 200221000010675
 * @description: 操作状态
 * @author: 赵航
 * @create: 2019-03-07 11:48
 **/
public enum BusinessStatus {

    SUCCESS(0, "成功"),
    FAIL(1, "失败");

    int code;
    String message;

    BusinessStatus(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public static String valueOf(Integer value) {
        if (value == null) {
            return "";
        } else {
            for (BusinessStatus ms : BusinessStatus.values()) {
                if (ms.getCode() == value) {
                    return ms.getMessage();
                }
            }
            return "";
        }
    }
}
